package com.transaction.demo.test;

public class FindMost2 {

    public static void main(String[] args) {
        //查出连续的数组连续数字最多的数组
        int[] arr = {1, 2, 3, 5, 4, 6, 5, 5, 6, 5, 6, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 6, 6, 6};

        int count = 0;
        int countNumber = 0;
        for (int i = 0; i < arr.length; i++) {
            int count2 = 0;
            for (int j = i; i < arr.length; i++) {
                if (arr[i] == arr[j]) {
                    count2 = count2 + 1;
                } else {
                    break;
                }
                if (count2 > count) {
                    count = count2;
                    countNumber = arr[i];
                }
            }
        }
        System.out.println("countNumber" + countNumber);

    }
}
